package se.energimyndigheten.lampguiden.lighting;

public class Room {

    private String mDocument;
    private String mImageFormat;
    private String mName;
    private Light[] mLights;

    public Room(String name, String document, String format){
        mName = name;
        mDocument = document;
        mImageFormat = format;
    }

    public String getDocument() {
        return mDocument;
    }

    public void setDocument(String mDocument) {
        this.mDocument = mDocument;
    }

    public String getImageFormat() {
        return mImageFormat;
    }

    public void setImageFormat(String mImageFormat) {
        this.mImageFormat = mImageFormat;
    }

    public String getName() {
        return mName;
    }

    public void setName(String mName) {
        this.mName = mName;
    }

    public void setLights(Light[] lights) {
        mLights = lights;
    }

    public Light[] getLights() {
        return mLights;
    }

    public Light instantiateLight(String name, String hotspotX, String hotspotY) {
        return new Light(name, hotspotX, hotspotY);
    }

    @Override
    public String toString() {
        return "Name: " + mName + "\nDocument: " +mDocument + "\nnrOfLights: " + mLights.length;
    }

    public class Light {
        private String mName;
        private String mDocument;
        private Double mPointX;
        private Double mPointY;
        private int[] mOffset;

        public Light(String document, String pointX, String pointY) {
            mDocument = document;
            mPointX = Double.parseDouble(pointX);
            mPointY = Double.parseDouble(pointY);
        }

        public double getLeftOffset() {
            return mPointX;
        }

        public double getTopOffset() {
            return mPointY;
        }

        public String getDocument() { return mDocument; }

        public void setOffset(int left, int top) {
            this.setOffset(left, top, 0);
        }
        public void setOffset(int left, int top, int right) {
            mOffset = new int[] {left, top, right};
        }

        public int[] getOffset() {
            return mOffset;
        }
    }
}
